extends Area3D

const SPEED = 5.0
const RANGE = 10.0

var travelled_distance = 0.0  # 移动距离

func _physics_process(delta: float) -> void:
	position += -transform.basis.z * SPEED * delta
	travelled_distance += SPEED * delta
	if travelled_distance > RANGE:
		# 移动距离超出指定距离
		queue_free()


func _on_body_entered(body: Node3D) -> void:
	queue_free() # 删除子弹
	if body.has_method("take_damage"):
		body.take_damage() #子弹击中怪物
